/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.util.Collection;
import java.util.HashSet;

/**
 *
 * @author sio
 */
public class Pays {
    private Collection <Dep> lesDeps ;
    private Collection <Specialite> lesSpec;
    
    public Pays(){
        lesDeps=DAO.getLesDeps();
        lesSpec = DAO.getLesSpec();
        Collection <Med> lesMeds = DAO.getLesMeds();
        
        for (Med unMed : lesMeds){
            for (Specialite uneSpe : lesSpec){
                if (uneSpe.getNom().equals(unMed.getSpe())){
                    uneSpe.addMed(unMed);
                }
            }
            for (Dep unDep : lesDeps){
                if(unMed.getDep().equals(unDep.getNum())){
                    unDep.addMed(unMed);
                }
            }
        }
    }
    
    
    
    public Collection <Dep> getLesDeps(){
        return lesDeps;
    }
    
    public Collection <Specialite> getLesSpecs(){
        return lesSpec;
    }
    
    public Specialite getLaSpe(String nomSpe){
        for (Specialite s : lesSpec){
            if(s.getNom().equals(nomSpe)){
                return s;
            }
        }
        return null;
    }
    
    public Dep getLeDep(String numDep){
        for(Dep d : lesDeps){
            if(d.getNum().equals(numDep)){
                return d;
            }
        }
        return null ;
    }
}
